
	
var myVar = setInterval(function()
	{
		//myTimer()
		retornarHorario("relogio");		
	}, 1000); // 1 segundo = 1 * 1000

function retornarHorario(id)
{
	var date = new Date();
	
	var strDate = retornarData(date);

	var currentDate = strDate;
	var currentTime = date.toLocaleTimeString();
	
	var currentDateTime = currentDate + ", " + currentTime;
	var diaPorExtenso = date.toLocaleDateString().split(",")[0];
	letraMaiuscula = diaPorExtenso.substr(0,1).toUpperCase();
	letrasMinusculas = diaPorExtenso.substr(1, diaPorExtenso.lenght);
	diaPorExtenso = letraMaiuscula + letrasMinusculas;  
			
	document.getElementById(id).innerHTML = diaPorExtenso+", "+ currentDateTime;
}

function retornarData(date){
	
	var fullAno = date.getFullYear().toString();
	var mes = date.getMonth().toLocaleString();
	var dia = date.getDate().toLocaleString();
	
	mes = new Number(mes) + 1;
	dia = new Number(dia);
	//fullAno = new Number(fullAno);
	
	var fullData;
	
	if(dia < 10 && mes < 10) {
		fullData = "0"+dia + "/0" + mes + "/" + fullAno;			
	}
	else if(dia >= 10 && mes < 10){
		fullData = dia + "/0" + mes + "/" + fullAno;
	}
	else if(dia < 10 && mes >= 10) {
		fullData = "0"+dia + "/" + mes + "/" + fullAno;
	}
	else{
		fullData = dia + "/" + mes + "/" + fullAno;
	}
	
	return fullData;
}

function myTimer()
{
	var date = new Date();
	var currentTime = date.toLocaleTimeString();
	document.getElementById("relogio").innerHTML = currentTime;
}